#include "head.h"
#include "ui_main.h"

Game* g_Game;

void Init()
{
	g_Game = new Game;
	g_ui->SetStandardSize({ 1920, 1080 });
	g_scene->Add("main", new UIMain);
}

void Run()
{
	g_ui->SetHide(g_input->KeyState(KeyCode::F2));


	if (g_input->KeyState(KeyCode::F1))
	{
		g_ui->RenderDebug();
	}
}

void Release()
{
	delete g_Game;
}

int Main()
{
	{
		Engine::Param& p = Engine::GetParamRef();
		p._setConsoleUtf8 = false;
		Engine::Init();
	}
	g_log->SetLogFile("log/");

	g_factory->SetPath("image/", "model/", "binary/", "temp/");
	//g_factory->SetReleaseMode();
	g_audio->Init("sound/config.json");
	g_time->SetFPS(60);
	g_system->SetFuncInit(Init);
	g_system->SetFuncRun(Run);

	g_lang->LoadXlsx("language.xlsx");
	g_lang->SetLangCurrent(Language::E_CHINESE);
	ParamWindow p;
	p._size = { 1920, 1080 };
	p._strTitle = lang("ui.窗口标题");
	g_system->Start(p);

	Release();
	Engine::Release();
	return 0;
}
